podgast.test<-function(x, y){
# Podgor-Gastwirth two-sample location-scale test as described in Marozzi (2013) p.1301
# The p-value is the asymptotic p-value from an F-distribution with 2 and (N-3) degrees of freedom
m<-length(x)
n<-length(y)
N<-m+n
Ivec<-c(rep(1,times=m),rep(0,times=n))
Svec<-rank(c(x,y))
Svec2<-Svec^2
Smat<-as.matrix(cbind(Int=rep(1,times=N),Svec,Svec2))
bvec<-solve(t(Smat)%*%Smat)%*%(t(Smat)%*%Ivec)
numer<-(t(bvec)%*%t(Smat)%*%Ivec - m^2/N)/2
denom<-(m - t(bvec)%*%t(Smat)%*%Ivec)/(N-3)
PGstat<-numer/denom
p.value<-pf(PGstat,df1=2,df2=(N-3),lower.tail=FALSE)
return(list(statistic=PGstat,p.value=p.value))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.